﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using client.helpers;
using client.viewmodels;

namespace client.views
{
    public partial class LoginView : UserControl
    {
        private MainViewModel _vm = null;

        public LoginView()
        {
            InitializeComponent();
            this.DataContextChanged += LoginView_DataContextChanged;
        }

        private void LoginView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _vm = e.NewValue as MainViewModel;
        }

        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            _ = _vm.Login(_userTextBox.Text, _pwdTextBox.Password);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}
